#ifndef __MCS__NULL_POINTER__EXCEPTION__HPP
#define __MCS__NULL_POINTER__EXCEPTION__HPP

#include "RunTimeException.hpp"

class NullPointerException : public RunTimeException
{
public:
	NullPointerException(SourceLocation const & location, String expression)
		: RunTimeException()
		, location_(location)
		, expression_(expression)
	{}

	SourceLocation location() const { return location_; }
	String expression() const { return expression_; }

	virtual std::ostream & stream(std::ostream & str) const
	{
		return str << location_ << ": Unexpected null pointer was formed in expression \"" << expression_ << "\".";
	}
private:
	SourceLocation location_;
	String expression_;
};


#endif //__MCS__NULL_POINTER__EXCEPTION__HPP
